import { createStore, combineReducers } from 'redux'

function zhangsan(state = 111, action) {
    switch(action.type) {
        case 'ADD_ZHANG_SAN':
            state += 10
            return state
        default:
            return state
    }
}

function lisi(state = 222, action) {
    switch(action.type) {
        case 'ADD_LI_SI':
            state += 100
            return state
        default:
            return state
    }
}

let reducer = combineReducers({
    zhangsan,
    lisi
})

let store = createStore(reducer)

window.store = store

export default store






// let reducer = (state, action) => {
//     return {
//         zhangsan: zhangsan(state.zhangsan, action),
//         lisi: lisi(state.lisi, action)
//     }
// }

// let initState = {
//     zhangsan: 10000,
//     lisi: 55555
// }

// let store = createStore(reducer, initState)

// window.store = store

// export default store